home *** CD-ROM | disk | FTP | other *** search
- {\magonebf 4.5 Hashing arrays (h\_array)}
-
- \decltwo h\_array I E
-
- {\bf 1. Definition}
-
- An instance $A$ of the parameterized data type \name\ (hashing array)
- is an injective mapping from the data type $I$, called the index type of $A$,
- to the set of variables of data type $E$, called the element type of $A$.
- $I$ must be an integer, pointer, or item type.
-
-
-
- \bigskip
- {\bf 2. Creation}
-
- \create A (x)
-
- creates an injective function $a$ from $I$ to the set of unused variables of
- type $E$, assigns $x$ to all variables in the range of $a$ and initializes $A$
- with $a$.
-
-
-
- \bigskip
- {\bf 3. Operations}
-
- \+\cleartabs & \hskip 1.8truecm & \hskip 5truecm &\cr
- \+\opa E\& {I\ x}
- {returns the variable $A(x)$}
- \smallskip
- \+\op bool defined {I\ x}
- {returns true if $x \in dom(A)$, false otherwise; here}
- \+\nop {$dom(A)$ is the set of all $x\in I$ for which $A[x]$ has}
- \+\nop {already been executed.}
-
- \bigskip
- {\bf 4. Iteration}
-
- {\bf forall\_defined}($x,A$)
- $\{$ ``the elements from $dom(A)$ are successively assigned to $x$'' $\}$
-
-
- \bigskip
- {\bf 5. Implementation}
-
- Hashing arrays are implemented by dynamic perfect hashing ([DKMMRT88]).
- Access operations $A[x]$ take time $O(1)$. Hashing arrays are more efficient
- than dictionary arrays.
-
-